<template>
  <div class="page-container">
    <h2 class="page-title">限时抢购</h2>
    <el-tabs v-model="active">
      <el-tab-pane label="进行中" name="ongoing">
        <div class="grid">
          <el-card v-for="item in ongoing" :key="item.id" shadow="hover" class="card">
            <img :src="item.image" class="thumb" />
            <div class="info">
              <div class="name">{{ item.name }}</div>
              <div class="prices">
                <span class="current">¥{{ item.price }}</span>
                <span class="original" v-if="item.original">¥{{ item.original }}</span>
              </div>
              <el-button type="primary" size="small">立即抢购</el-button>
            </div>
          </el-card>
        </div>
      </el-tab-pane>
      <el-tab-pane label="即将开始" name="upcoming">
        <div class="grid">
          <el-card v-for="item in upcoming" :key="item.id" shadow="hover" class="card">
            <img :src="item.image" class="thumb" />
            <div class="info">
              <div class="name">{{ item.name }}</div>
              <el-tag type="warning">即将开始</el-tag>
            </div>
          </el-card>
        </div>
      </el-tab-pane>
      <el-tab-pane label="已结束" name="ended">
        <el-empty description="活动已结束" />
      </el-tab-pane>
    </el-tabs>
  </div>
  </template>
<script setup>
import { ref } from 'vue'
const active = ref('ongoing')
const ongoing = [
  { id: 1, name: '宁北 X1 智能手机', price: 2899, original: 3499, image: 'https://img95.699pic.com/photo/60045/3122.jpg_wh860.jpg' },
  { id: 2, name: '宁北 轻薄本 Air14', price: 4399, original: 5299, image: 'https://images.unsplash.com/photo-1496181133206-80ce9b88a853?w=800&h=800&fit=crop' }
]
const upcoming = [
  { id: 3, name: '宁北 户外背包', image: 'https://images.unsplash.com/photo-1542831371-29b0f74f9713?w=800&h=800&fit=crop' }
]
</script>
<style scoped>
.page-container { max-width: 1100px; margin: 0 auto; padding: var(--spacing-xl); }
.page-title { font-size: var(--font-size-xl); font-weight: var(--font-weight-bold); margin-bottom: var(--spacing-lg); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--spacing-lg); }
.card { display: flex; flex-direction: column; }
.thumb { width: 100%; height: 160px; object-fit: cover; border-radius: var(--radius-md); }
.info { display: flex; flex-direction: column; gap: var(--spacing-sm); padding-top: var(--spacing-sm); }
.name { font-weight: var(--font-weight-medium); }
.prices { display: flex; gap: var(--spacing-sm); align-items: center; }
.current { color: var(--danger-color); font-weight: var(--font-weight-bold); }
.original { color: var(--text-secondary); text-decoration: line-through; }
</style>